<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');

?>
<div><label>Всего приглашенных: </label><?php echo sizeof($this->all); ?></div>

<details>
<summary>Статистика</summary>
<dl>
<?php
$sides = array();
for($i=0; $i<sizeof($this->all); $i++) {
	$item = $this->all[$i];
	
	if(!isset($sides[$item->side])) {
		$sides[$item->side] = array();
		$sides[$item->side]['items'] = array();
	}
	
	$sides[$item->side]['items'][] = $item;
	$sides[$item->side]['state_'.$item->state][] = $item;	
}

foreach ($sides as $side=>$v) {
		echo "<fieldset><legend style='font-size: 1em; padding: 0;'><em>Со стороны ".($side==1 ? JText::_('COM_MARIAGEPLANNER_GUEST_HUSBAND') : JText::_('COM_MARIAGEPLANNER_GUEST_WIFE') ).":</em> ".sizeof($v['items'])."</legend>";
		echo "<div style='margin-left: 5px;'>";
		foreach ($v as $state=>$v2) {
			if($state == 'items')
				continue;
			echo "<div style='padding: 2px 5px; border:  none;' class='".($state=='state_1' ? '' : ($state=='state_0' ? 'ui-state-highlight' : 'ui-state-error'))."'>";
			echo "<dt><em>".($state=='state_1' ? JText::_('COM_MARIAGEPLANNER_GUEST_WILL') : ($state=='state_0' ? JText::_('COM_MARIAGEPLANNER_GUEST_POSSIBLY') : JText::_('COM_MARIAGEPLANNER_GUEST_UNLIKELY') )).":</em></dt>";
			
			foreach($v2 as $item)
				echo "<dd>{$item->name}</dd>";
				
			echo "</div>";
		}		
		echo "</div>";
		echo "</fieldset>";
} ?>
</dl>
</details>